#ifndef INVOICEITEMDIALOG_H
#define INVOICEITEMDIALOG_H

#include "ui_InvoiceItemDialog.h"
#include "Customer.h"
#include "InvoiceItem.h"
#include "ProductsModel.h"

#include <QSortFilterProxyModel>
#include <QModelIndex>

namespace ecocity
{


class InvoiceItemDialog : public QDialog, private Ui::InvoiceItemDialog
{
    Q_OBJECT

public:

    InvoiceItemDialog( Customer::TYPE customer_type,
                       const std::vector< Product >& products,
                       QWidget* parent = 0 );

    // Get Results from Dialog
    InvoiceItem get_item( ) const;

private slots:

    // Called when ComboBox filters proveiders by name
    void show_products_from_proveider( QString proveider );

    void show_or_hide_weight( const QModelIndex& );

    // Se llama cuando se cierra el Dialogo con Accept
    void accept( );

private:

    void hide_prices_for_other_customer_types( Customer::TYPE customer_type );

    Product product_from_filter_model( const QModelIndex& index );

private:

    Customer::TYPE m_customer_type;

    InvoiceItem m_item;

    ProductsModel m_products_model;

    QSortFilterProxyModel* products_filter_model;
};

} // namespace ecociy



#endif // INVOICEITEMDIALOG_H
